package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreBookmark;
import com.fujitsu.nanjing.tieba.ibator.CoreBookmarkCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreBookmarkDAOImpl extends SqlMapClientDaoSupport implements CoreBookmarkDAO {

    public CoreBookmarkDAOImpl() {
        super();
    }

    public int countByExample(CoreBookmarkCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_bookmark.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreBookmarkCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_bookmark.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer markid) {
        CoreBookmark _key = new CoreBookmark();
        _key.setMarkid(markid);
        int rows = getSqlMapClientTemplate().delete("core_bookmark.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreBookmark record) {
        getSqlMapClientTemplate().insert("core_bookmark.insert", record);
    }

    public void insertSelective(CoreBookmark record) {
        getSqlMapClientTemplate().insert("core_bookmark.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreBookmark> selectByExample(CoreBookmarkCriteria example) {
        List<CoreBookmark> list = getSqlMapClientTemplate().queryForList("core_bookmark.selectByExample", example);
        return list;
    }

    public CoreBookmark selectByPrimaryKey(Integer markid) {
        CoreBookmark _key = new CoreBookmark();
        _key.setMarkid(markid);
        CoreBookmark record = (CoreBookmark) getSqlMapClientTemplate().queryForObject("core_bookmark.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreBookmark record, CoreBookmarkCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_bookmark.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreBookmark record, CoreBookmarkCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_bookmark.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreBookmark record) {
        int rows = getSqlMapClientTemplate().update("core_bookmark.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreBookmark record) {
        int rows = getSqlMapClientTemplate().update("core_bookmark.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreBookmarkCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreBookmarkCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}